home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 52
/
Aminet 52 (2002)(GTI - Schatztruhe)[!][Dec 2002].iso
/
Aminet
/
game
/
think
/
AmiChess.lha
/
AmiChess
/
src
/
solve.c
< prev
next >
Wrap
C/C++ Source or Header
|
2002-10-31
|
767b
|
43 lines
#include <clib/alib_protos.h>
#include <stdio.h>
#include <string.h>
#include "common.h"
void Solve(char *file)
{
short total,correct,found;
long TotalNodes;
char *p;
total=correct=0;
TotalNodes=0;
SET(flags,SOLVE);
while(ReadEPDFile(file,0))
{
NewPosition();
total++;
DoMethod(mui_app,MUIM_Chess_ShowBoard);
Iterate();
TotalNodes+=NodeCnt+QuiesCnt;
p=solution;
found=false;
while(*p)
{
if(!strncmp(p,SANmv,strlen(SANmv)))
{
correct++;
found=true;
break;
}
while(*p!=' ' && *p) p++;
while(*p==' ' && *p) p++;
}
printf("%s : ",id);
printf(found?"Correct: " : "Incorrect: ");
printf("%s %s\n",SANmv,solution);
printf("Correct=%d Total=%d\n",correct,total);
}
printf("\nTotal nodes = %ld\n",TotalNodes);
CLEAR(flags,SOLVE);
}